import api from '@/api/index.js'
import {refreshTokenPost} from '@/api/refreshToken.js'

const url = '/setting/role/'
// 查询租户列表
export function RoleListGet(params) {
  refreshTokenPost(api)
  return api({
    url: url + 'rolelist/',
    method: 'get',
    params: params,
  })
}

// 新增租户
export function RoleListPost(data) {
  return api({
    url: url + 'rolelist/',
    method: 'post',
    data: data,
  })
}


// 查询租户单个
export function RolePkGet(pk) {
  return api({
    url: url + 'rolepk/' + pk + '/',
    method: 'get',
  })
}
// 修改租户
export function RolePkPut(data,pk) {
  return api({
    url: url + 'rolepk/' + pk + '/',
    method: 'put',
    data: data,
  })
}

// 删除租户
export function RolePkDelete(pk) {
  return api({
    url: url + 'rolepk/' + pk + '/',
    method: 'delete',
  })
}

// 查询角色权限
export function RolePermissionListGet(params) {
  refreshTokenPost(api)
  return api({
    url: url + 'rolepermissionlist/',
    method: 'get',
    params: params,
  })
}

//分配角色权限
export function RolePermissionListPost(data) {
  return api({
    url: url + 'rolepermissionlist/',
    method: 'post',
    data: data,
  })
}


// 查询角色用户分配
export function RoleUserListGet(params) {
  refreshTokenPost(api)
  return api({
    url: url + 'roleuserlist/',
    method: 'get',
    params: params,
  })
}

//分配角色用户
export function RoleUserListPost(data) {
  return api({
    url: url + 'roleuserlist/',
    method: 'post',
    data: data,
  })
}